<?php

require_once 'Base.php';

class UserModel extends Base {
	
	
	public function updateuser($data,$where){
		$this->_db = $this->getAdapter();
		//$where = $this->_db->quoteInto('id = ?', $id);//条件
		
		$res=$this->_db->update($this->_table,$data,$where);
		return $res;
		
	}
	
	public function getuser($where){
	
		//print_r($where);
		
		$this->where($where);
		return $this->fetch();
     
		
		//print_r($smsCodeend); die();
	
	
	}
	
	
	public function adduser($mobile){
	
	    $data['mobile'] =$mobile;
	    $data['username'] =$mobile;
	    $data['password'] =md5(123456);
	    $data['ctime'] =time();
	    $data['salt']=md5($mobile.rand(1000,9999));
        $this->_db = $this->getAdapter();
       // print_r($data);
        $this->_db->insert($this->_table,$data);
    
        return $this->_db->lastInsertId();
		//print_r($smsCodeend); die();
	}
	
	
}
